import sqlalchemy


from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker


engine = create_engine('mysql+pymysql://root:123456@localhost:3306/stock')
Base = sqlalchemy.orm.declarative_base()

def get_session():
    Base.metadata.create_all(engine)
    Session = sessionmaker(bind=engine)
    session = Session()
    return  session